from time import sleep

from selenium.webdriver.common.by import By

from day0409.Base import Base

class Page1(Base):
    # 定位器
    qingdl_loc = (By.XPATH, '/html/body/div[2]/div/div[1]/div/a[1]')
    def qingdl(self):
        self.click(self.qingdl_loc)

    user_loc = (By.ID, 'userName')
    def user(self,username):
        self.send_keys(self.user_loc, username)

    pwd_loc = (By.ID, 'password')
    def pwd(self,password):
        self.send_keys(self.pwd_loc,password)

    login_loc = (By.NAME, 'bi_Usuallogin')
    def login(self):
        self.click(self.login_loc)

    # 确定
    qd_loc = (By.CLASS_NAME, 'bindSub')
    def qd(self):
        self.click(self.qd_loc)


    # 业务逻辑
    def jiuxian_luoji_01(self,username,password):
        # 打开网址
        self.open_url('https://www.jiuxian.com/')
        sleep(1)
        self.qingdl()
        sleep(1)
        self.user(username)
        sleep(1)
        self.pwd(password)
        sleep(10)
        self.login()

